﻿using Wulong.Phone.Dianping.Constants;

namespace Wulong.Phone.Dianping.Models
{
    public class Merchant
    {
        private static readonly string BaseUrl = CommonConstants.MobileHomePage;
        public string Id { get; set; }
        private string _name;
        public string Name { 
            get { return _name; } 
            set
            {
                if(string.IsNullOrWhiteSpace(value)) return;
                _name = value.Replace("&amp;", "&");
            }
        }
        private string _link;
        public string Link { 
            get { return BaseUrl + _link; }
            set { _link = value; }
        }
        public bool IsMember { get; set; }
        public bool HasPromotion { get; set; }
        public string AvgPrice { get; set; }
        public string Circle { get; set; }
        public string SubCategory { get; set; }
        public string Addr { get; set; }
        public string Tel { get; set; }
        public string OverallRating { get; set; }
        public string DetailRating { get; set; }
        public string Desc { get; set; }
        public string Features { get; set; }
        private string _imageUrl;
        public string ImageUrl
        {
            get { return _imageUrl; } 
            set
            {
                if (string.IsNullOrWhiteSpace(value)||value.EndsWith(".gif")) value = "/Images/Merchant_Nopic.png";
                _imageUrl = value;
            }
        }
        public int ReviewCount { get; set; }
        public string DianpingMapLink { get; set; }
        public string PromotionLink { get; set; }
    }
}
